package day5;

import java.util.Scanner;


/**
 * 牛客:统计回文
 */

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String s1 = scanner.nextLine();
        String s2 = scanner.nextLine();

        //char[] chars = s1.toCharArray();
        //StringBuffer stringBuffer = new StringBuffer();
        //StringBuffer stringBuffer1 = new StringBuffer("");

        //StringBuilder stringBuilder = new StringBuilder();

        int count = 0;
        int len = s1.length();
        int i = 0;

        while (i <= len){
//            String s3 = s1.substring(0,i);
//            String s4 = s1.substring(i, s1.length());
//            stringBuffer.append(s3);
//            stringBuffer.append(s2);
//            stringBuffer.append(s4);
            StringBuffer stringBuffer = new StringBuffer(s1);
            stringBuffer.insert(i,s2);
            if (isPalindrome(String.valueOf(stringBuffer))) {
                count++;
            }
            i++;
        }

        System.out.println(count);
    }



    private static boolean isPalindrome(String s) {
        int len = s.length() - 1;
        boolean flag = false;
        for (int i = 0; i <= len; i++) {
            if (s.charAt(i) == s.charAt(len - i)){
                flag = true;
            }else {
                return false;
            }
        }
        return true;
    }
}